package com.abe.libcore

import android.app.Application
import android.content.Context
import androidx.multidex.MultiDexApplication
import com.abe.libcore.utils.CrashHandler

open class AbeApplication : MultiDexApplication() {

    companion object {
        var app: Application? = null
        fun getInstance() = app!!

        fun getContext(): Context? {
            return app!!.applicationContext
        }
    }

    override fun onCreate() {
        super.onCreate()
        app = this@AbeApplication
        initCrash()
    }

    fun initCrash() {
        val handler: CrashHandler = CrashHandler.getInstance()
        handler.init(getContext())
    }
}